#include "GMKeyChangeDirectInput.h"
#include "Engine.h"
#include "GameState.h"

bool GMKeyChangeDirectInput::ReadFromSckMsg( Networking::SockMsg* sm )
{
    if(!sm->ReadInt((int*)(&m_pressed)))
        return false;
    if(!sm->ReadInt(&m_key))
        return false;
    if(!sm->ReadInt(&m_clientID))
        return false;
    if(!sm->ReadInt((int*)(&m_state)))
        return false;

    return true;
}
void GMKeyChangeDirectInput::WriteToSckMsg( Networking::SockMsg* sm )
{
    sm->WriteInt((int) m_pressed);
    sm->WriteInt(m_key);
    sm->WriteInt(m_clientID);
    sm->WriteInt((int)m_state);
}

bool GMKeyChangeDirectInput::Execute()
{
    Engine::Instance()->GetCurrentState()->NotifyKeyPressDirectInput(m_pressed, m_key, m_state, m_clientID);
    return true;
}